#include <iostream>
using namespace std;

//n代表数组长度，m代表待求的数，arr代表数列
int n,m,arr[];
//解空间
int solvespace[5] = {0};

void printOneResult(){
    for(int i = 0;i < n;i++)
        if(solvespace[i])
            cout << arr[i] << " ";
    cout << endl;
}

void backtrack(int level){
    if(level == n){//递归出口
        //计算sum值
        int sum = 0;
        for(int i = 0;i < n;i++)
            if(solvespace[i])
                sum += arr[i];
        //如果sum的值等于要求的值m，则输出一个解
        if(sum == m)
            printOneResult();    
        return;
    }
    solvespace[level] = 0;
    backtrack(level+1);
    solvespace[level] = 1;
    backtrack(level+1);
}

int main(){
    //从键盘输入参数
    cin >> m;
    cin >> n;
    for(int i = 0;i < n;i++)
        cin >> arr[i];
    //开始回溯
    backtrack(0);
    return 1;
}